

//This function returns the multiplier between attack and victim types
PM_FUNC_NORM_ATTRIB Float:TypeMultiplier( PM_TYPE:iAttackType, PM_TYPE:iVictimType )
{
	pokemod_funcstart_debug( "TypeMultiplier" );

	new Float:fMultiplier = 1.0;

	if ( iVictimType == TYPE_NONE )
	{
		pokemod_funcend_debug( "TypeMultiplier No Type" );
		return fMultiplier;
	}

	const Float:fMultDouble = 2.0;
	const Float:fMultHalf = 0.5;
	const Float:fMultZero = 0.0;

	if ( iAttackType & TYPE_NORMAL )
	{
		if ( iVictimType & (TYPE_ROCK|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_GHOST) )
			fMultiplier *= fMultZero;
	}
	if ( iAttackType & TYPE_FIRE )
	{
		if ( iVictimType & (TYPE_GRASS|TYPE_BUG|TYPE_ICE|TYPE_STEEL) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_FIRE|TYPE_WATER|TYPE_ROCK|TYPE_DRAGON) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_WATER )
	{
		if ( iVictimType & (TYPE_FIRE|TYPE_ROCK|TYPE_GROUND) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_GRASS|TYPE_WATER|TYPE_DRAGON) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_GRASS )
	{
		if ( iVictimType & (TYPE_WATER|TYPE_ROCK|TYPE_GROUND) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_GRASS|TYPE_FIRE|TYPE_BUG|TYPE_POISON|TYPE_FLYING|TYPE_DRAGON|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_ELECTRIC )
	{
		if ( iVictimType & (TYPE_WATER|TYPE_FLYING) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_GRASS|TYPE_ELECTRIC|TYPE_DRAGON) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_GROUND) )
			fMultiplier *= fMultZero;
	}
	if ( iAttackType & TYPE_ICE )
	{
		if ( iVictimType & (TYPE_WATER|TYPE_ICE|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_GRASS|TYPE_FLYING|TYPE_DRAGON) )
			fMultiplier *= fMultDouble;
	}
	if ( iAttackType & TYPE_FIGHTING )
	{
		if ( iVictimType & (TYPE_POISON|TYPE_FLYING|TYPE_PSYCHIC|TYPE_BUG) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_NORMAL|TYPE_ICE|TYPE_ROCK|TYPE_DARK|TYPE_STEEL) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_GHOST) )
			fMultiplier *= fMultZero;
	}
	if ( iAttackType & TYPE_POISON )
	{
		if ( iVictimType & (TYPE_GRASS|TYPE_BUG) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_ROCK|TYPE_GROUND|TYPE_POISON|TYPE_GHOST) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_STEEL) )
			fMultiplier *= fMultZero;
	}
	if ( iAttackType & TYPE_GROUND )
	{
		if ( iVictimType & (TYPE_GRASS|TYPE_BUG) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_FIRE|TYPE_ELECTRIC|TYPE_ROCK|TYPE_POISON|TYPE_STEEL) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_FLYING) )
			fMultiplier *= fMultZero;
	}
	if ( iAttackType & TYPE_FLYING )
	{
		if ( iVictimType & (TYPE_ELECTRIC|TYPE_ROCK|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_GRASS|TYPE_FIGHTING|TYPE_BUG) )
			fMultiplier *= fMultDouble;
	}
	if ( iAttackType & TYPE_PSYCHIC )
	{
		if ( iVictimType & (TYPE_POISON|TYPE_FIGHTING) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_PSYCHIC|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
		if ( iVictimType & (TYPE_DARK) )
			fMultiplier *= fMultZero;
	}
	if ( iAttackType & TYPE_BUG )
	{
		if ( iVictimType & (TYPE_GRASS|TYPE_PSYCHIC|TYPE_POISON|TYPE_DARK) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_FIRE|TYPE_FIGHTING|TYPE_FLYING|TYPE_GHOST|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_ROCK )
	{
		if ( iVictimType & (TYPE_FIRE|TYPE_ICE|TYPE_FLYING|TYPE_BUG) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_FIGHTING|TYPE_GROUND|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_GHOST )
	{
		if ( iVictimType & (TYPE_GHOST) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_DARK|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_DRAGON )
	{
		if ( iVictimType & (TYPE_DRAGON) )
			fMultiplier *= fMultDouble;
		if ( iVictimType & (TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_DARK )
	{
		if ( iVictimType & (TYPE_DARK|TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}
	if ( iAttackType & TYPE_STEEL )
	{
		if ( iVictimType & (TYPE_STEEL) )
			fMultiplier *= fMultHalf;
	}

	pokemod_funcend_debug( "TypeMultiplier %f", fMultiplier );

	return fMultiplier;
}

